<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>搜索结果</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css" th:href="@{/css/me.css}">
</head>
<body>


<!--导航的部分--><!--有线程的组件-->
<nav class="ui inverted vertical attach segment m-padded-tb-mini m-shadow-small">
    <div class="ui container">
        <!--左边的导航-->
        <div class="ui secondary inverted stackable menu">
            <h2 class="ui header teal item">Timous</h2>
            <a href="#" th:href="@{/}" class="m-item item m-mobile-hide"><i class="mini home icon"></i>首页</a>
            <a href="#" th:href="@{/types/-1}" class="m-item item m-mobile-hide"><i class="mini idea icon"></i>分类</a>
            <a href="#" th:href="@{/tags/-1}" class="m-item item m-mobile-hide"><i class="mini tags icon"></i>标签</a>
            <a href="#" th:href="@{/archives}" class="m-item item m-mobile-hide"><i class="mini clone icon"></i>归档</a>
            <a href="#" th:href="@{/blogabout}"   class="m-item item m-mobile-hide"><i class="mini info icon"></i>关于我</a>
            <a href="#" th:href="@{/types/-1}"   class="m-item item m-mobile-hide"><i class="mini music icon"></i>音乐盒</a>
            <a href="#" th:href="@{/types/-1}"  class="m-item item m-mobile-hide"><i class="mini user icon"></i>友人帐</a>
            <a href="#" th:classappend="${num==8} ? 'active'" class="m-item item m-mobile-hide"><i class="mini photo icon"></i>照片墙</a>
            <div class="m-item right item m-mobile-hide">
                <div class="ui icon inverted transparent input">
                    <input type="text" placeholder="Search...">
                    <i class="search link icon"></i>
                </div>
            </div>
        </div>


        <!--        加一个隐藏的图标-->
        <a href="#" class="ui menu toggle black icon button m-top-right m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </div>


</nav>

<!--中间的内容-->
<div class="m-padded-tb-massive m-container-small">
    <div class="ui container">
        <!--        頭部的信息-->
        <div class="ui segment top attached">
            <div class="ui middle aligned two column grid">
                <div class="column">
                    <h3 class="ui teal header">搜索结果</h3>
                </div>
                <div class="right aligned column">
                    共<h2 class="ui orange header m-inline-block m-text-thin" th:text="${page.totalElements}">14</h2>个
                </div>
            </div>
        </div>


        <div class="ui teal top attached segment">
            <!--博客的内容-->
            <div class="ui padded vertical segment m-padded-tb-huge" th:each="blog : ${page.content}">

                <div class="ui middle aligned mobile reversed stackable  grid">

                    <!--首页展示的博客的具体的内容-->
                    <div class="ui eleven wide column">
                        <!--博客的标题-->

                        <h3 class="ui header">
                            <a href="#" target="_blank" th:href="@{/blog/{id}(id=${blog.id})}" class="m-black"
                               th:text="|${blog.title}....|">你真的理解什么是财富自由吗？</a>
                        </h3>

                        <!--博客里面的内容-->
                        <p class="m-text" th:text="${blog.description}">Lorem ipsum dolor sit amet, consectetur
                            adipisicing elit. Debitis eaque exercitationem quibusdam. Aliquam animi culpa dicta eius
                            excepturi exercitationem facere, ipsa laudantium natus non nostrum odit quaerat quia quidem,
                            tempore!</p>

                        <div class="ui grid">
                            <!--左边的下面的内容-->
                            <div class="eleven wide column">

                                <div class="ui link mini list horizontal">
                                    <div class="item">
                                        <img src="https://picsum.photos/id/1005/100/100" th:src="@{${blog.user.avatar}}"
                                             alt="" class="ui avatar image">
                                        <div class="content">

                                            <a href="#" class="header" th:text="${blog.user.nickname}">陈留红</a>

                                        </div>
                                    </div>

                                    <div class="item">

                                        <i class="icon calendar"></i><span
                                            th:text="${#dates.format(blog.updateTime,'yyyy-MM-dd')}">2017-10-1</span>

                                    </div>

                                    <div class="item">

                                        <i class="icon eye"></i><span th:text="${blog.views}">12</span>

                                    </div>

                                </div>

                            </div>
                            <div class="five wide column right aligned ">
                                <a href="#" class="ui label teal basic m-padded-mini m-text-thin" target="_blank"
                                   th:text="${blog.type.name}">认知升级</a>
                            </div>

                        </div>
                    </div>

                    <!--博客的图片的部分-->
                    <div class="ui five wide column">

                        <a href="#" target="_blank" th:href="@{/blog/{id}(id=${blog.id})}">

                            <img src="https://picsum.photos/id/1005/800/400" th:src="${blog.firstPicture}" alt=""
                                 class="ui rounded image">

                        </a>


                    </div>

                </div>

            </div>
        </div>
        <!--分页-->
        <div class="ui bottom attached segment" th:if="${page.totalPages}>1">
            <div class="ui middle aligned two column grid">
                <div class="column">
                    <a href="#" th:href="@{/search(page=${page.number}-1)}" th:unless="${page.first}"
                       class="ui button teal basic m-padded-tb-large">上一页</a>
                </div>
                <div class="right aligned column">
                    <a href="" th:href="@{/search(page=${page.number}+1)}" th:unless="${page.last}"
                       class="ui button teal basic m-padded-tb-large">下一页</a>
                </div>
            </div>

        </div>

    </div>
</div>


<!--底部的内容-->
<!--底部的内容-->
<footer  class="ui segment inverted vertical me-padded-td-mini">
    <div class=" m-padded-tb-massive ui center aligned container">
        <!--grid会把整个页面分成16分-->
        <div class="ui divided  inverted stackable grid ">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../static/images/wechat.png" th:src="@{/images/wechat.png}" class="ui rounded image"
                             alt="" style="width:110px;">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../static/images/wechat.png" th:src="@{/images/wechat.png}" class="ui rounded image"
                             alt="" style="width:110px;">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-space m-opacity-mini">联系我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item m-text-thin m-text-space m-opacity-mini" th:text="#{index.email}">Email：1844736251@qq.com</a>
                    <a href="#" class="item m-text-thin m-text-space m-opacity-mini" th:text="#{index.QQ}">QQ:1844736251</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-space m-opacity-mini">本网站营业时间</h4>
                <div id="time"></div>
            </div>
        </div>
        <div class="ui inverted section divider"></div>
        <p class="m-text-thin m-text-space m-opacity-mini">Copyright © 2020-2021 Timous Designed By 陈留红</p>
    </div>
</footer>

<!-- 引入Jquery-->
<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
<!-- 引入组件库 -->
<script src="https://cdn.jsdelivr.net/semantic-ui/2.2.4/semantic.min.js"></script>
<script src="../static/js/me.js" th:src="@{/js/me.js}"></script>



<script>


    // 运行时间统计
    function secondToDate(second) {
        if (!second) {
            return 0;
        }
        var time = new Array(0, 0, 0, 0, 0);
        if (second >= 365 * 24 * 3600) {
            time[0] = parseInt(second / (365 * 24 * 3600));
            second %= 365 * 24 * 3600;
        }
        if (second >= 24 * 3600) {
            time[1] = parseInt(second / (24 * 3600));
            second %= 24 * 3600;
        }
        if (second >= 3600) {
            time[2] = parseInt(second / 3600);
            second %= 3600;
        }
        if (second >= 60) {
            time[3] = parseInt(second / 60);
            second %= 60;
        }
        if (second > 0) {
            time[4] = second;
        }
        return time;
    }

    function setTime() {
        /*此处为网站的创建时间*/
        var create_time = Math.round(new Date(Date.UTC(2020, 1, 25, 15, 15, 15)).getTime() / 1000);
        var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
        currentTime = secondToDate((timestamp - create_time));
        currentTimeHtml = currentTime[0] + '年' + currentTime[1] + '天'
            + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4]
            + '秒';
        document.getElementById("time").innerHTML = currentTimeHtml;
    }

    setInterval(setTime, 1000);


    $("#newblog-container").load(/*[[@{/footer/newblog}]]*/"/footer/newblog");

</script>
</body>
</html>